<%@ include file="/taglibs.jsp"%>

	<!-- If the user has signed in, the page shold diplay welcome information, 
		sign out button. At the same time, the signIn and joinFree button should be hidden
		If the user has not signed in, the page should display signIn, joinFree button and
		hidden signOut button.-->
	 
     <div class="navbar navbar-inverse navbar-fixed-top">
      <div class="navbar-inner">
        <div class="container">
          <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </a>
          <a class="brand" href="${ctx}"><strong>IOBIKE</strong></a>
          <div class="nav-collapse collapse">
			<ul class="nav">
				<li><a href="${ctx}/trade!list.action?trade.product.primaryCategory.id=BIKES" title="Trading">Trading</a></li>
				<li><a href="${ctx}/product!list.action" title="Wiki">Wiki</a></li>
				<sec:authorize access="hasAnyRole('ROLE_sdfsd','ROLE_SUPERVISOR')">
					<li><a href="${ctx}/setup/catalog!index.action" title="Catalogs">Catalogs</a></li>
					<li><a href="${ctx}/product!index.action" title="Catalogs">Products</a></li>
				</sec:authorize>
				<li><a href="${ctx}/blog!index.action" title="Blog">Blog</a></li>
			</ul>
            <ul class="nav pull-right">
            	<sec:authentication property='principal' var="principal"/>
				<c:choose>
					<c:when	test="${'anonymousUser' == principal}">
						<li><a href="${ctx}/showLoginPage.action" class="setup topLink bold">
							<s:text name="button.signIn"/></a></li>
						<li><a href="${ctx}/showSignUpPage.action" class="setup topLink bold">
							<s:text name="button.joinFree"/></a></li>
					</c:when>
					
					<c:otherwise>
						
						  <li class="dropdown">
						   <a class="dropdown-toggle" data-toggle="dropdown" href="#">
						  	<i class="icon-user icon-white"></i>
							<sec:authentication property='name'/>
							 <span class="caret"></span></a>
						  <ul class="dropdown-menu">
						    <li><a href="${ctx}/trade!showSelectCategoryPage.action"><i class="icon-pencil"></i> <s:text name="button.postAd"/></a></li>
						    <li><a href="${ctx}/account!index.action"><i class="icon-user"></i> <s:text name="button.account"/></a></li>
						    <sec:authorize access="hasAnyRole('ROLE_SUPERVISOR')">
						    <li><a href="${ctx}/setup/setup!index.action"><i class="icon-wrench"></i> <s:text name="button.setup"/></a></li>
						    </sec:authorize>
						    <li><a href="#"><i class="icon-ban-circle"></i> Ban</a></li>
						    <li class="divider"></li>
						    <li><a href="${ctx}/j_spring_security_logout"><i class="icon-off"></i> <s:text name="button.signOut"/></a></li>
						  </ul>
						</li>
					</c:otherwise>
				</c:choose>
            </ul>
          </div><!--/.nav-collapse -->
        </div>
      </div>
    </div>